Non-GUI Spell Checker

The RapidSpellChecker component is of particular use in non-GUI scenarios. Below is a very simple excerpt of how this component can be used.

Code Example

.........
    RapidSpellChecker c = new RapidSpellChecker();
    BadWord badWord;
    ArrayList suggestions;

    //check some text.
    c.Check("This is sume text.");


    //iterate through all bad words in the text.
    while((badWord = c.NextBadWord())!=null){

        Console.WriteLine(badWord.GetWord() +
            "- is not spelt correctly. Suggestions:");

        try{
            //get suggestions for the current bad word.
            suggestions = c.FindSuggestions();

            //display all suggestions.
            for(int i=0; i<suggestions.Count; i++){
                Console.WriteLine(suggestions[i]);
            }

            //change the bad word in the text with "replacement".
            c.ChangeBadWord("replacement");
        } catch (NoCurrentBadWordException e){
            Console.WriteLine(e);
        }
    }
    Console.WriteLine(c.GetAmendedText());
.........